package leetcode.hot100;

import java.util.HashSet;

@SuppressWarnings("all")
public class _287_寻找重复数_集合 {
    public int findDuplicate(int[] nums) {
        if (nums == null || nums.length == 0) return 0;
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums) {
            if (!set.add(num)) return num;
        }
        return 0;
    }
}
